import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/5/3
 */
public class Demo22 {
    static int lowBit(int x){
        return x & -x;
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();

        while (true) {
            if (n-- == 0) break;

            int x = scan.nextInt();
            int res = 0;

            while (x != 0) {
                x -= lowBit(x);
                res++;
            }
            System.out.print(res + " ");
        }

    }
}
